<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('选择总行')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<input type="hidden" name="bankName" th:value="${headBank}">
						<ul>
							<li>
								<label>支行名称：</label>
								<input type="text" name="subbranchName"/>
							</li>
							<li>
								<label style="width: 80px">开户地-省：</label>
								<input type="text" name="province"/>
							</li>
							<li>
								<label style="width: 80px">开户地-市：</label>
								<input type="text" name="city"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        $(function() {
			var options = {
				url: ctx + "bankInfo/bankInfo/list",
				showSearch: false,
				showRefresh: false,
				showToggle: false,
				showColumns: false,
				clickToSelect:true,
				columns: [{
					radio: true
				},
				{
					field : 'subbranchName',
					title : '支行名称'
				},
				{
					field : 'subbranchId',
					title : '支付系统行号'
				},
				{
					field : 'province',
					title : '开户地-省'
				},
				{
					field : 'city',
					title : '开户地-市'
				},
				]
			};
            $.table.init(options);
        });
        
        /* 选择总行 */
		function submitHandler(index, layero) {
			var rows = $.table.selectFirstColumns();
			if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		}
			$.modal.close();
			parent.$("#branchBank").val($.table.selectColumns("subbranchName"));
			parent.$("#subbranchId").val($.table.selectColumns("subbranchId"));
			/*parent.$("#province").val($.table.selectColumns("province"));
			parent.$("#city").val($.table.selectColumns("city"));*/
			parent.$("#bankNum").val($.table.selectColumns("subbranchId"));

		}
    </script>
</body>
</html>